package com.minelx.woods.server.entity;

import com.minelx.woods.server.dao.UserDTO;
import com.minelx.woods.server.dao.UserRepository;

public class Users {
	private final UserRepository userRepository;

	public Users(UserRepository userRepository) {
		this.userRepository = userRepository;
	}

	public String register(String name, String password) {
		UserDTO addedUser = new UserDTO(name, password);
		userRepository.add(addedUser);
		return addedUser.getName();
	}

	public User id(String registeredName) {
		return new User(userRepository, registeredName);
	}

	public void clear() {
		userRepository.removeAll();
	}
}
